<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
 */
$api = app('Dingo\Api\Routing\Router');

// v2 version API
// add in header    Accept:application/vnd.lumen.v2+json
$api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($api) {

    //驾校推广报名
    $api->get('recruit/get_set', [
        'as' => 'recruit.get_set',
        'uses' => 'RecruitController@getSet',
    ]);

    $api->post('recruit/add_extension', [
        'as' => 'recruit.add_extension',
        'uses' => 'RecruitController@addExtension',
    ]);

    $api->post('recruit/update_extension', [
        'as' => 'recruit.update_extension',
        'uses' => 'RecruitController@updateExtension',
    ]);
    $api->get('recruit/get_extension', [
        'as' => 'recruit.get_extension',
        'uses' => 'RecruitController@getExtension',
    ]);

    $api->post('recruit/sign_up', [
        'as' => 'recruit.sign_up',
        'uses' => 'RecruitController@signUp',
    ]);

    $api->get('recruit/get_record', [
        'as' => 'recruit.get_record',
        'uses' => 'RecruitController@getRecord',
    ]);

    $api->post('recruit/withdraw', [
        'as' => 'recruit.withdraw',
        'uses' => 'RecruitController@withdraw',
    ]);

    $api->get('recruit/get_school', [
        'as' => 'recruit.get_school',
        'uses' => 'RecruitController@getSchool',
    ]);

    $api->get('recruit/get_service', [
        'as' => 'recruit.get_service',
        'uses' => 'RecruitController@getService',
    ]);


    // User
    $api->post('users', [
        'as' => 'users.store',
        'uses' => 'UserController@store',
    ]);
    // user list
    $api->get('users', [
        'as' => 'users.index',
        'uses' => 'UserController@index',
    ]);
    // user detail
    $api->get('users/{id}', [
        'as' => 'users.show',
        'uses' => 'UserController@show',
    ]);


    // POST
    // post list
    $api->get('posts', [
        'as' => 'posts.index',
        'uses' => 'PostController@index',
    ]);
    // post detail
    $api->get('posts/{id}', [
        'as' => 'posts.show',
        'uses' => 'PostController@show',
    ]);

    // POST COMMENT
    // post comment list
    $api->get('posts/{postId}/comments', [
        'as' => 'posts.comments.index',
        'uses' => 'PostCommentController@index',
    ]);

    /*
     * 对于authorizations 并没有保存在数据库，所以并没有id，那么对于
     * 刷新（put) 和 删除（delete) 我没有想到更好的命名方式
     * 所以暂时就是 authorizations/current 表示当前header中的这个token。
     * 如果 tokekn 保存保存在数据库，那么就是 authorizations/{id}，像 github 那样。
     */


    // Auth
    // login 登陆
    $api->post('authorizations', [
        'as' => 'authorizations.store',
        'uses' => 'AuthController@store',
    ]);
    //刷新token
    $api->put('authorizations/current', [
        'as' => 'authorizations.update',
        'uses' => 'AuthController@update',
    ]);





    //获取公共信息 banner
    $api->get('public/banner', [
        'as' => 'public.appbanner',
        'uses' => 'PublicController@appbanner',
    ]);

    //安卓版本检测
    $api->get('public/updateAndroid', [
        'as' => 'public.updateAndroid',
        'uses' => 'PublicController@updateAndroid',
    ]);

    //公共信息提交意见反馈
    $api->post('public/feedback', [
        'as' => 'public.feedback',
        'uses' => 'PublicController@feedback',
    ]);

    //驾考攻略
    $api->get('public/simulatbook', [
        'as' => 'public.simulatbook',
        'uses' => 'PublicController@simulatbook',
    ]);


    //公共信息资讯热点
    $api->post('public/news', [
        'as' => 'public.news',
        'uses' => 'PublicController@news',
    ]);


    //公共信息资讯热点
    $api->post('public/handBook', [
        'as' => 'public.handBook',
        'uses' => 'PublicController@handBook',
    ]);


    //一件反馈列表
    $api->get('public/feedbackList', [
        'as' => 'public.feedbackList',
        'uses' => 'PublicController@feedbackList',
    ]);





    // resetPassword my password
    $api->put('user/resetpassword', [
        'as' => 'user.resetPassword',
        'uses' => 'UserController@resetPassword',
    ]);


    // resetPassword my password
    $api->put('user/deviceToken', [
        'as' => 'user.deviceToken',
        'uses' => 'UserController@deviceToken',
    ]);


    //支付宝回调---
    $api->post('pay/alinotify', [
        'as' => 'pay.alinotify',
        'uses' => 'PayController@alinotify',
    ]);

    //微信支付回调---
    $api->post('pay/wxnotify', [
        'as' => 'pay.wxnotify',
        'uses' => 'PayController@wxnotify',
    ]);

    //微信支付回调---
    $api->post('pay/wxAppnotify', [
        'as' => 'pay.wxAppnotify',
        'uses' => 'PayController@wxAppnotify',
    ]);




    // need authentication
    $api->group(['middleware' => 'api.auth'], function ($api) {
        /*
         * 对于authorizations 并没有保存在数据库，所以并没有id，那么对于
         * 刷新（put) 和 删除（delete) 我没有想到更好的命名方式
         * 所以暂时就是 authorizations/current 表示当前header中的这个token。
         * 如果 tokekn 保存保存在数据库，那么就是 authorizations/{id}，像 github 那样。
         */

        //退出登陆
        $api->delete('authorizations/current', [
            'as' => 'authorizations.destroy',
            'uses' => 'AuthController@destroy',
        ]);
        /***
         *
         * 培训记录
         *
        **/

        //我的培训
        $api->get('putime', [
            'as' => 'putime.index',
            'uses' => 'PutimeController@index',
        ]);

        //电子教学日志
        $api->get('putime/log', [
            'as' => 'putime.log',
            'uses' => 'PutimeController@putimeLog',
        ]);

        //查看培训投诉
        $api->get('putime/showComplainInfo', [
            'as' => 'putime.showComplainInfo',
            'uses' => 'PutimeController@showComplainInfo',
        ]);

        //提交培训评价
        $api->post('putime/postCommentInfo', [
            'as' => 'putime.postCommentInfo',
            'uses' => 'PutimeController@postCommentInfo',
        ]);

        //查看培训评价
        $api->get('putime/showCommentInfo', [
            'as' => 'putime.showCommentInfo',
            'uses' => 'PutimeController@showCommentInfo',
        ]);


        //投诉培训记录
        $api->get('putime/complainInfo', [
            'as' => 'putime.complainInfo',
            'uses' => 'PutimeController@complainInfo',
        ]);

        //投诉培训记录
        $api->post('putime/postComplainInfo', [
            'as' => 'putime.postComplainInfo',
            'uses' => 'PutimeController@postComplainInfo',
        ]);


        //教学记录
        $api->get('putime/teachingRecord', [
            'as' => 'putime.teachingRecord',
            'uses' => 'PutimeController@teachingRecord',
        ]);

        //无效学时
        $api->get('putime/getNovalidPutime', [
            'as' => 'putime.getNovalidPutime',
            'uses' => 'PutimeController@getNovalidPutime',
        ]);

        $api->get('putime/latestRecord', [
            'as' => 'putime.latestRecord',
            'uses' => 'PutimeController@latestRecord',
        ]);

        /***
         *
         * 预约学车
         *
         **/
        //学员首页
        $api->get('student', [
            'as' => 'student.index',
            'uses' => 'StudentController@index',
        ]);

        //支付记录
        $api->get('student/getPayRecord', [
            'as' => 'student.getPayRecord',
            'uses' => 'StudentController@getPayRecord',
        ]);


        //预约学车
        $api->get('student/studyCar', [
            'as' => 'student.studyCar',
            'uses' => 'StudentController@studyCar',
        ]);

        //预约学车
        $api->get('student/periodList', [
            'as' => 'student.periodList',
            'uses' => 'StudentController@periodList',
        ]);


        //教练详情
        $api->get('student/coachDetails', [
            'as' => 'student.coachDetails',
            'uses' => 'StudentController@coachDetails',
        ]);

        //学员评论
        $api->get('student/comments', [
            'as' => 'student.comments',
            'uses' => 'StudentController@comments',
        ]);

        //学员投诉
        $api->get('student/complaints', [
            'as' => 'student.complaints',
            'uses' => 'StudentController@complaints',
        ]);

        //学员我的驾校
        $api->get('student/myschool', [
            'as' => 'student.myschool',
            'uses' => 'StudentController@mySchool',
        ]);

        //学员我的驾校评价
        $api->get('student/myschoolevaluates', [
            'as' => 'student.myschoolevaluates',
            'uses' => 'StudentController@mySchoolEvaluates',
        ]);

        //学员我的驾校
        $api->get('student/mycoachs', [
            'as' => 'student.mycoachs',
            'uses' => 'StudentController@myCoachs',
        ]);

        //学员我的教练评价
        $api->get('student/mycoachevaluates', [
            'as' => 'student.mycoachevaluates',
            'uses' => 'StudentController@myCoachEvaluates',
        ]);

        //评论详情
        $api->get('student/evaluateDetails', [
            'as' => 'student.evaluateDetails',
            'uses' => 'StudentController@evaluateDetails',
        ]);

        //评论驾校展示
        $api->get('student/showSchoolEvaluate', [
            'as' => 'student.showSchoolEvaluate',
            'uses' => 'StudentController@showSchoolEvaluate',
        ]);

        //评论驾校提交数据
        $api->get('student/postSchoolEvaluate', [
            'as' => 'student.postSchoolEvaluate',
            'uses' => 'StudentController@postSchoolEvaluate',
        ]);


        //评论统计
        $api->get('student/evaluateStatistics', [
            'as' => 'student.evaluateStatistics',
            'uses' => 'StudentController@evaluateStatistics',
        ]);

        //教练排班
        $api->get('student/coachStudytime', [
            'as' => 'student.coachStudytime',
            'uses' => 'StudentController@coachStudytime',
        ]);

        //教练排班查询
        $api->get('student/coachPeriodtime', [
            'as' => 'student.coachPeriodtime',
            'uses' => 'StudentController@coachPeriodtime',
        ]);

        //预约提示
        $api->get('student/subscribeHint', [
            'as' => 'student.subscribeHint',
            'uses' => 'StudentController@subscribeHint',
        ]);

        //预约处理
        $api->post('student/subscribe', [
            'as' => 'student.subscribe',
            'uses' => 'StudentController@subscribe',
        ]);


        //学时钱包记录
        $api->get('student/studyTimeLog', [
            'as' => 'student.studyTimeLog',
            'uses' => 'StudentController@studyTimeLog',
        ]);







        //教练报表查询搜索
        $api->get('coach', [
            'as' => 'coach.index',
            'uses' => 'CoachController@index',
        ]);

         //教练预约信息查看
        $api->get('coach/periodList', [
            'as' => 'coach.periodList',
            'uses' => 'CoachController@periodList',
        ]);

        //教练取消预约
        $api->post('coach/cancelPutime', [
            'as' => 'coach.cancelPutime',
            'uses' => 'CoachController@cancelPutime',
        ]);

        //教练删除未预约学时
        $api->post('coach/deletePutime', [
            'as' => 'coach.deletePutime',
            'uses' => 'CoachController@deletePutime',
        ]);
        //教练预个人资料查看
        $api->get('coach/profile', [
            'as' => 'coach.profile',
            'uses' => 'CoachController@profile',
        ]);

        //
        $api->get('coach/myPutperiod', [
            'as' => 'coach.myPutperiod',
            'uses' => 'CoachController@myPutperiod',
        ]);

        $api->get('coach/myTrainRecords', [
            'as' => 'coach.myTrainRecords',
            'uses' => 'CoachController@myTrainRecords',
        ]);

        //教练请假信息查看
        $api->get('coach/coachLeaveList', [
            'as' => 'coach.coachLeaveList',
            'uses' => 'CoachController@coachLeaveList',
        ]);

        //请假处理
        $api->post('coach/coachLeave', [
            'as' => 'coach.coachLeave',
            'uses' => 'CoachController@coachLeave',
        ]);

        //消息中心首页
        $api->get('coach/myMessages', [
            'as' => 'coach.myMessages',
            'uses' => 'CoachController@myMessages',
        ]);
        //教练的学员

        $api->get('coach/mystudentzmlist', [
            'as' => 'coach.mystudentzmlist',
            'uses' => 'CoachController@mystudentzmlist',
        ]);
        //教练学员详情
        $api->get('coach/mystudentinfo', [
            'as' => 'coach.mystudentinfo',
            'uses' => 'CoachController@mystudentinfo',
        ]);

        //教练学员投诉列表
        $api->get('coach/statelist', [
            'as' => 'coach.statelist',
            'uses' => 'CoachController@statelist',
        ]);

        //教练学员评价列表
        $api->post('coach/commentsList', [
            'as' => 'coach.commentsList',
            'uses' => 'CoachController@commentsList',
        ]);

        //教练报表
        $api->get('coach/myreport', [
            'as' => 'coach.myreport',
            'uses' => 'CoachController@myreport',
        ]);

        //教练报表查询搜索
        $api->get('coach/searchReport', [
            'as' => 'coach.searchReport',
            'uses' => 'CoachController@searchReport',
        ]);

        //教练删除工时
        $api->post('coach/delPeriod', [
            'as' => 'coach.delPeriod',
            'uses' => 'CoachController@delPeriod',
        ]);

        //工时模板列表
        $api->get('coach/templateList', [
            'as' => 'coach.templateList',
            'uses' => 'CoachController@templateList',
        ]);

        //工时模板添加
        $api->post('coach/templateAdd', [
            'as' => 'coach.templateAdd',
            'uses' => 'CoachController@templateAdd',
        ]);

        //工时模板修改
        $api->post('coach/templateUpate', [
            'as' => 'coach.templateUpate',
            'uses' => 'CoachController@templateUpate',
        ]);

        //工时模板删除
        $api->get('coach/templateDel', [
            'as' => 'coach.templateDel',
            'uses' => 'CoachController@templateDel',
        ]);

        //教练学时投放列表
        $api->get('coach/periodPutlist', [
            'as' => 'coach.periodPutlist',
            'uses' => 'CoachController@periodPutlist',
        ]);

        //教练学时投放
        $api->post('coach/periodAdd', [
            'as' => 'coach.periodAdd',
            'uses' => 'CoachController@periodAdd',
        ]);

        //教练模板设为个人默认
        $api->post('coach/templateSaveDefault', [
            'as' => 'coach.templateSaveDefault',
            'uses' => 'CoachController@templateSaveDefault',
        ]);


        //教练帮学员预约列表
        $api->get('coach/studentSublist', [
            'as' => 'coach.studentSublist',
            'uses' => 'CoachController@studentSublist',
        ]);

        //教练帮学员预约处理
        $api->post('coach/sutdentSub', [
            'as' => 'coach.sutdentSub',
            'uses' => 'CoachController@sutdentSub',
        ]);


//----------------------------------------------------------------------------

        //驾校首页
        $api->get('school/index', [
            'as' => 'school.index',
            'uses' => 'SchoolController@index',
        ]);

        //驾校教练预约管理列表
        $api->get('school/subscribeList', [
            'as' => 'school.subscribeList',
            'uses' => 'SchoolController@subscribeList',
        ]);


        //驾校教练预约详情列表
        $api->get('school/coachPeriod', [
            'as' => 'school.coachPeriod',
            'uses' => 'SchoolController@coachPeriod',
        ]);

        //驾校帮学员预约列表
        $api->get('school/coachStudent', [
            'as' => 'school.coachStudent',
            'uses' => 'SchoolController@coachStudent',
        ]);


        //驾校帮学员预约
        $api->post('school/studentSub', [
            'as' => 'school.studentSub',
            'uses' => 'SchoolController@studentSub',
        ]);

        //驾校帮学员取消预约
        $api->post('school/studentSubDel', [
            'as' => 'school.studentSubDel',
            'uses' => 'SchoolController@studentSubDel',
        ]);

        //驾校综合报表
         $api->get('school/summaryReport', [
             'as' => 'school.summaryReport',
             'uses' => 'SchoolController@summaryReport',
         ]);

        //驾校综合报表搜索
        $api->get('school/searchReport', [
            'as' => 'school.searchReport',
            'uses' => 'SchoolController@searchReport',
        ]);

        //驾校教练列表
        $api->get('school/coachList', [
            'as' => 'school.coachList',
            'uses' => 'SchoolController@coachList',
        ]);

        //驾校车辆列表
        $api->get('school/carList', [
            'as' => 'school.carList',
            'uses' => 'SchoolController@carList',
        ]);

        //驾校评论列表管理
        $api->get('school/commentList', [
            'as' => 'school.commentList',
            'uses' => 'SchoolController@commentList',
        ]);

        //驾校投诉列表管理
        $api->get('school/complainList', [
            'as' => 'school.complainList',
            'uses' => 'SchoolController@complainList',
        ]);

        //驾校评论列表
        $api->get('school/commentListReport', [
            'as' => 'school.commentListReport',
            'uses' => 'SchoolController@commentListReport',
        ]);

        //驾校区域
        $api->get('school/teachareaList', [
            'as' => 'school.teachareaList',
            'uses' => 'SchoolController@teachareaList',
        ]);

        //驾校学员报表
        $api->get('school/studentReport', [
            'as' => 'school.studentReport',
            'uses' => 'SchoolController@studentReport',
        ]);

        //驾校教练评价列表
        $api->get('school/coachCommentReport', [
            'as' => 'school.coachCommentReport',
            'uses' => 'SchoolController@coachCommentReport',
        ]);

        //驾校教练详情
        $api->get('school/coachDetail', [
            'as' => 'school.coachDetail',
            'uses' => 'SchoolController@coachDetail',
        ]);






        /***
         *
         * 我的预约
         *
         **/
        //我的预约
        $api->get('student/mySubscribe', [
            'as' => 'student.mySubscribe',
            'uses' => 'StudentController@mySubscribe',
        ]);


        $api->get('student/mySubscribeCount', [
            'as' => 'student.mySubscribeCount',
            'uses' => 'StudentController@mySubscribeCount',
        ]);

        //学时付款
        $api->post('student/payment', [
            'as' => 'student.payment',
            'uses' => 'StudentController@payment',
        ]);

        //取消学时
        $api->post('student/cancelPeriod', [
            'as' => 'student.cancelPeriod',
            'uses' => 'StudentController@cancelPeriod',
        ]);

        //学时统计
        $api->get('student/periodStatistics', [
            'as' => 'student.periodStatistics',
            'uses' => 'StudentController@periodStatistics',
        ]);

        //取消学时教练反馈
        $api->get('student/feedback', [
            'as' => 'student.feedback',
            'uses' => 'StudentController@feedback',
        ]);


        //消息中心首页
        $api->get('student/myMessages', [
            'as' => 'student.myMessages',
            'uses' => 'StudentController@myMessages',
        ]);

        $api->get('student/myCenter', [
            'as' => 'student.myCenter',
            'uses' => 'StudentController@myCenter',
        ]);


        //理论学习
        $api->get('practice/theory', [
            'as' => 'practice.theory',
            'uses' => 'PracticeController@theory',
        ]);


        //理论测试题目获取
        $api->get('practice/detail', [
            'as' => 'practice.detail',
            'uses' => 'PracticeController@detail',
        ]);


        //理论视频学习记录提交
        $api->post('practice/theoryRecord', [
            'as' => 'practice.theoryRecord',
            'uses' => 'PracticeController@theoryRecord',
        ]);

        //理论模拟测试获取题表
        $api->get('practice/simulate', [
            'as' => 'practice.simulate',
            'uses' => 'PracticeController@simulate',
        ]);

        //理论模拟视频学习权限
        $api->get('practice/theoryCheck', [
            'as' => 'practice.theoryCheck',
            'uses' => 'PracticeController@theoryCheck',
        ]);

        //理论模拟视频学习支付状态
        $api->get('practice/theoryPayCheck', [
            'as' => 'partice.theoryPayCheck',
            'uses' => 'PracticeController@theoryPayCheck',
        ]);

        //理论练习章节列表
        $api->get('practice/getChapterList', [
            'as' => 'practice.chapterList',
            'uses' => 'PracticeController@chapterList',
        ]);

        //理论练习章节列表题目
        $api->get('practice/chapterLearn', [
            'as' => 'practice.chapterLearn',
            'uses' => 'PracticeController@chapterLearn',
        ]);

        //理论错题添加
        $api->post('practice/addWrong', [
            'as' => 'practice.addWrong',
            'uses' => 'PracticeController@addWrong',
        ]);


        //删除错题记录
        $api->delete('pratice/delWrong', [
            'as' => 'pratice.delWrong',
            'uses' => 'PraticeController@delWrong',
        ]);


        //获取错题记录
        $api->get('pratice/getWrongList', [
            'as' => 'partice.wronglist',
            'uses' => 'PracticeController@wrongList',
        ]);


        //获取错题记录
        $api->post('practice/theoryPhoto', [
            'as' => 'partice.theoryPhoto',
            'uses' => 'PracticeController@theoryPhoto',
        ]);


        //获取错题记录
        $api->get('practice/learnRandom', [
            'as' => 'partice.learnRandom',
            'uses' => 'PracticeController@learnRandom',
        ]);

        //获取错题记录
        $api->get('practice/learnOrder', [
            'as' => 'partice.learnOrder',
            'uses' => 'PracticeController@learnOrder',
        ]);



        //视频支付------------
        $api->get('pay/video', [
            'as' => 'pay.video',
            'uses' => 'PayController@videoPay',
        ]);


        //微信公众号视频支付------------
        $api->get('pay/WxPubVideoPay', [
            'as' => 'pay.WxPubVideoPay',
            'uses' => 'PayController@WxPubVideoPay',
        ]);

        //微信App视频支付------------
        $api->get('pay/WxAppVideoPay', [
            'as' => 'pay.WxAppVideoPay',
            'uses' => 'PayController@WxAppVideoPay',
        ]);



        //预约支付------------
        $api->get('pay/subscribe', [
            'as' => 'pay.subscribe',
            'uses' => 'PayController@subscribePay',
        ]);


        //微信公众号预约学车支付------------
        $api->get('pay/WxPubSubscribePay', [
            'as' => 'pay.WxPubSubscribePay',
            'uses' => 'PayController@WxPubSubscribePay',
        ]);

        //微信App预约学车支付------------
        $api->get('pay/WxAppSubscribePay', [
            'as' => 'pay.WxAppSubscribePay',
            'uses' => 'PayController@WxAppSubscribePay',
        ]);























        // USER
        // my detail
        $api->get('user', [
            'as' => 'user.show',
            'uses' => 'UserController@userShow',
        ]);
        //me
        $api->get('user/me', [
            'as' => 'user.me',
            'uses' => 'UserController@me',
        ]);


        // update part of me
        $api->patch('user', [
            'as' => 'user.update',
            'uses' => 'UserController@patch',
        ]);
        // update my password
        $api->post('user/password', [
            'as' => 'user.password.update',
            'uses' => 'UserController@editPassword',
        ]);





        // POST
        // user's posts index
        $api->get('user/posts', [
            'as' => 'user.posts.index',
            'uses' => 'PostController@userIndex',
        ]);
        // create a post
        $api->post('posts', [
            'as' => 'posts.store',
            'uses' => 'PostController@store',
        ]);
        // update a post
        $api->put('posts/{id}', [
            'as' => 'posts.update',
            'uses' => 'PostController@update',
        ]);
        // update part of a post
        $api->patch('posts/{id}', [
            'as' => 'posts.patch',
            'uses' => 'PostController@patch',
        ]);
        // delete a post
        $api->delete('posts/{id}', [
            'as' => 'posts.destroy',
            'uses' => 'PostController@destroy',
        ]);

        // POST COMMENT
        // create a comment
        $api->post('posts/{postId}/comments', [
            'as' => 'posts.comments.store',
            'uses' => 'PostCommentController@store',
        ]);
        $api->put('posts/{postId}/comments/{id}', [
            'as' => 'posts.comments.update',
            'uses' => 'PostCommentController@update',
        ]);
        // delete a comment
        $api->delete('posts/{postId}/comments/{id}', [
            'as' => 'posts.comments.destroy',
            'uses' => 'PostCommentController@destroy',
        ]);


    });
});
